﻿using System;
using System.Collections.Generic;
using System.Data.Services;
using System.Linq;
using System.ServiceModel.Web;
using System.Web;
using System.ServiceModel;

namespace Niagara.Sample.Web
{
#if DEBUG
  [ServiceBehavior(IncludeExceptionDetailInFaults=true)]
#endif
  public class GameService : DataService<GamesEntities>
  {
    // This method is called only once to initialize service-wide policies.
    public static void InitializeService(DataServiceConfiguration config)
    {
      config.SetEntitySetAccessRule("Games", EntitySetRights.All);
      config.SetEntitySetAccessRule("Ratings", EntitySetRights.AllRead);
      config.SetEntitySetAccessRule("Genres", EntitySetRights.AllRead);

      config.DataServiceBehavior.AcceptCountRequests = true;
      config.DataServiceBehavior.AcceptProjectionRequests = true;
      config.DataServiceBehavior.MaxProtocolVersion = System.Data.Services.Common.DataServiceProtocolVersion.V2;

#if DEBUG
      config.UseVerboseErrors = true;
#endif
    }
  }
}
